package cms.web.action.common;

import cms.service.template.TemplateService;
import cms.utils.DbUtilsTemplate;
import cms.web.action.AccessSourceDeviceManage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 增加专家列表
 */

@Controller
public class MyController {

    //注入业务bean
    @Resource(name="templateServiceBean")
    private TemplateService templateService;//通过接口引用代理返回的对象

    @Resource
    AccessSourceDeviceManage accessSourceDeviceManage;

    @Autowired
    DbUtilsTemplate dbUtilsTemplate;

    @RequestMapping("/zhuanjia")
    public String execute(HttpServletRequest request, HttpServletResponse response, ModelMap model)
            throws Exception {

        //当前模板使用的目录
        String dirName = templateService.findTemplateDir_cache();

        String sql="select * from userrolegroup where userRoleId='497bbcd9a16a4281aff00fb496aba783'";
        List<Map<String,Object>> zjlist= dbUtilsTemplate.findListMap(sql);
        System.out.println(zjlist.size());
        int test=333;
        model.addAttribute("zjlist",zjlist);
        model.addAttribute("test",test);
        return "templates/"+dirName+"/"+accessSourceDeviceManage.accessDevices(request)+"/zhuanjia";
    }
}
